<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body {
            margin: 0;
        }

        .div1 {
            width: 200px;
            height: 200px;
            margin-bottom: 50px;
            background-color: #ccc;
        }

        .div2 {
            width: 200px;
            height: 200px;
            margin-top: 100px;
            background-color: #c9b3f3;
        }

        .bfc {
            /* display: inline-block; */
            /* position: absolute; */
            /* float: left; */
            overflow: hidden;
        }
    </style>
</head>

<body>
    <!-- 避免上下盒子margin重合 -->
    <div class="div1"></div>
    <div class="bfc">
        <div class="div2"></div>
    </div>
</body>

</html>